//
//  GuideViewController.m
//  ThePrivateKitchen
//
//  Created by lirui on 16/1/28.
//  Copyright © 2016年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "GuideViewController.h"
#import "AppDelegate.h"
#import "GuidePageVIew.h"
#import "LessonViewController.h"
#import "ShikeViewController.h"
#import "ShipuViewController.h"
#import "UserViewController.h"
#import "TopicViewController.h"
#import "ChurenhuiViewController.h"
@interface GuideViewController ()<GuidePageDelegate>

@end

@implementation GuideViewController

{
    GuidePageVIew *guidePage;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    guidePage =[[GuidePageVIew alloc] init];
    NSArray *array = @[@"1.jpg",@"2",@"3"];
    NSMutableArray *arr =[NSMutableArray arrayWithArray:array];
    [guidePage setPic:arr];
    guidePage.delegate = self;
    [self.view addSubview:guidePage];
    [guidePage release];
}
- (void)GuidePageViewEndGuide
{
    //食谱页
    ShipuViewController *shipu = [[ ShipuViewController alloc] init];
    UINavigationController *shipuNavi = [[ UINavigationController alloc] initWithRootViewController:shipu];
    UITabBarController *tabbar = [[ UITabBarController alloc] init];
    shipu.tabBarItem = [[ UITabBarItem alloc] initWithTitle:@"食谱" image:[UIImage imageNamed:@"shipinlineA@2x"] selectedImage:[UIImage imageNamed:@"shipinlineB@2x"]];
    
    
    //社区页
    TopicViewController *topic = [[ TopicViewController alloc] init];
    UINavigationController *topicNavi =[[ UINavigationController alloc] initWithRootViewController:topic];
    topic.tabBarItem =[[ UITabBarItem alloc] initWithTitle:@"下厨房" image:[UIImage imageNamed:@"iconfont-fangzi@2x"] selectedImage:[UIImage imageNamed:@"iconfont-fangzi-2@2x"]];
    //食课页
    LessonViewController *lesson = [[ LessonViewController alloc] init];
    UINavigationController *lessonNavi = [[ UINavigationController alloc] initWithRootViewController:lesson];
    lesson.tabBarItem =[[ UITabBarItem alloc] initWithTitle:@"学做菜" image:[UIImage imageNamed:@"iconfont-shu@2x"] selectedImage:[UIImage imageNamed:@"iconfont-shu-2@2x"]];
    //用户页
    UserViewController *user = [[ UserViewController alloc] init];
    UINavigationController *userNAvi =[[ UINavigationController alloc] initWithRootViewController:user];
    user.tabBarItem =[[ UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"chushimaoA@2x"] selectedImage:[UIImage imageNamed:@"chushimaoB@2x"]];
    
    //厨人汇
    ChurenhuiViewController *people = [[ ChurenhuiViewController alloc] init];
    UINavigationController *peopleNavi = [[UINavigationController alloc] initWithRootViewController:people];
    people.tabBarItem = [[ UITabBarItem alloc] initWithTitle:@"厨友汇" image:[UIImage imageNamed:@"iconfont-shequ@2x"] selectedImage:[UIImage imageNamed:@"iconfont-shequ-2@2x"]];
    
    tabbar.viewControllers = @[shipuNavi,topicNavi,lessonNavi,peopleNavi,userNAvi];
    
    AppDelegate *delegate = [UIApplication sharedApplication].delegate;
   
    [UIView animateWithDuration:1 animations:^{
        guidePage.alpha = 0;
    } completion:^(BOOL finished) {
        delegate.window.rootViewController = tabbar;
        

    }];

    [shipu release];
    [shipuNavi release];
    [topic release];
    [topicNavi release];
    [lesson release];
    [lessonNavi release];
    [userNAvi release];
    [user release];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
